<!--
    Copyright 2010 Justin Lipton, Jonathan Rosenberg
    
    This file is part of MediaList.

    MediaList is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    MediaList is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with MediaList.  If not, see <http://www.gnu.org/licenses/>.
-->

<div class=header>MediaList!</div>
<div class=body>
<span style="text-align:right;margin-left:570px">
<?php

    echo "Welcome " . $_COOKIE["user"] . "! (<a href=logout.php>Logout</a>)<br />";
  
?>
</span>
</div>
<h1>
<br />
<a href=addNewShow.php>Add a new show</a>
<br />
<?php 
    echo "<a href=profile.php?currentUser=".$_COOKIE["user"].">Profile page</a><br>";
    echo "<a href=table.php?currentUser=".$_COOKIE["user"].">Table page</a>";
    
    $con = mysql_connect("localhost", "root");
    if (!$con)
    {
        die('Could not connect: ' . mysql_error());
    }
    mysql_select_db("DB", $con);
    $sql="SELECT * FROM Users WHERE Username='".$_COOKIE["user"]."'";
    $result = mysql_query($sql, $con);           
    $row = mysql_fetch_array($result);
    //right now there is no way to make an admin from the site
    //you can only manually change the database to have Priveleges equal A
    if($row["Privileges"]=='A')
    {
        echo "<br/><a href=admin.php>Admin page</a>";
    }
?>
</h1>
